﻿// TSF点阵字库模块 [4/30/2012 JianbinZhu]
// TSF点阵字库模块 [4/30/2012 JianbinZhu]
// 等宽字库 且ASCII为GB 宽度的一半


//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define LOG(format, ...) printf(">> " format "\n", ##__VA_ARGS__)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define NULL (void*)0

public class mr_screenRectSt
{
	public ushort x;
	public ushort y;
	public ushort w;
	public ushort h;
}

//字体绘制样式
#if false
//#define TS_FT_BLOD 0x0002     //粗体
//#define TS_FT_ELASTIC 0x0004  //斜体
#endif

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define EM_PORT_API(rettype) rettype EMSCRIPTEN_KEEPALIVE
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define EM_PORT_API(rettype) rettype
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3))
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_color(r) ((r)->rb_parent_color & 1)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_is_red(r) (!rb_color(r))
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_is_black(r) rb_color(r)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define RB_ROOT (struct rb_root) { NULL, }
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define rb_entry(ptr, type, member) container_of(ptr, type, member)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define container_of(ptr, type, member) ({ const typeof( ((type *)0)->member ) *__mptr = (ptr); (type *)( (char *)__mptr - offsetof(type,member) );})
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define RB_EMPTY_NODE(node) (rb_parent(node) == node)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define offsetof(type, field) ((size_t) & ((type *)0)->field)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define countof(x) (sizeof(x) / sizeof((x)[0]))
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define ALIGN(x, align) (((x) + ((align)-1)) & ~((align)-1))
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define MAKERGB565(r, g, b) (uint16_t)(((uint32_t)(r >> 3) << 11) | ((uint32_t)(g >> 2) << 5) | ((uint32_t)(b >> 3)))
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define PIXEL565R(v) ((((uint32_t)v >> 11) << 3) & 0xff)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define PIXEL565G(v) ((((uint32_t)v >> 5) << 2) & 0xff)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define PIXEL565B(v) (((uint32_t)v << 3) & 0xff)

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define TSF_LOG LOGI

//字体信息结构体
public unsafe class fontPoint
{
	public int uIndexOff; // unicode字库索引表在字库文件中的偏移
	public int uIndexLen; // unicode字库索引表长度
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to value types:
//ORIGINAL LINE: byte *uIndexBuf;
	public byte* uIndexBuf; // unicode字库索引表缓冲区地址，字库索引表是会加载到内存的

	public int PointOff; //字库点阵在字库文件中的偏移
	public int PointLen; //字库点阵长度
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to value types:
//ORIGINAL LINE: byte *PointBuf;
	public byte* PointBuf; //字库点阵缓冲区（内存加载方式）

	public int GBWidth; // GB单个字符宽度
	public int AsciiWidth; // ascii单个字符宽度
	public int fontHeight; //单个字符高度

	public static byte[] font16_st = new byte[320]//20*16
	{
    0x54, 0x53, 0x46, 0x4F, 0x4E, 0x54, 0x00, 0x00, 0xD7, 0x16, 0x06, 0x00, 0x80, 0x00, 0x00, 0x00,//16
    0xB8, 0xBF, 0x00, 0x00, 0x38, 0xC0, 0x00, 0x00, 0x9F, 0x56, 0x05, 0x00, 0x10, 0x08, 0x10, 0x00,
    0xCB, 0xCE, 0xCC, 0xE5, 0x31, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0xCC, 0xEC, 0xCA, 0xB9, 0xD6, 0xAE, 0xD2, 0xED, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x21, 0x00, 0x00, 0x01, 0x00, 0x22, 0x00, 0x00, 0x13, 0x00, 0x23, 0x00, 0x00, 0x25, 0x00,
    0x24, 0x00, 0x00, 0x37, 0x00, 0x25, 0x00, 0x00, 0x49, 0x00, 0x26, 0x00, 0x00, 0x5B, 0x00, 0x27,
    0x00, 0x00, 0x6D, 0x00, 0x28, 0x00, 0x00, 0x7F, 0x00, 0x29, 0x00, 0x00, 0x91, 0x00, 0x2A, 0x00,
    0x00, 0xA3, 0x00, 0x2B, 0x00, 0x00, 0xB5, 0x00, 0x2C, 0x00, 0x00, 0xC7, 0x00, 0x2D, 0x00, 0x00,
    0xD9, 0x00, 0x2E, 0x00, 0x00, 0xEB, 0x00, 0x2F, 0x00, 0x00, 0xFD, 0x00, 0x30, 0x00, 0x01, 0x0F,
    0x00, 0x31, 0x00, 0x01, 0x21, 0x00, 0x32, 0x00, 0x01, 0x33, 0x00, 0x33, 0x00, 0x01, 0x45, 0x00,
    0x34, 0x00, 0x01, 0x57, 0x00, 0x35, 0x00, 0x01, 0x69, 0x00, 0x36, 0x00, 0x01, 0x7B, 0x00, 0x37,
    0x00, 0x01, 0x8D, 0x00, 0x38, 0x00, 0x01, 0x9F, 0x00, 0x39, 0x00, 0x01, 0xB1, 0x00, 0x3A, 0x00,
    0x01, 0xC3, 0x00, 0x3B, 0x00, 0x01, 0xD5, 0x00, 0x3C, 0x00, 0x01, 0xE7, 0x00, 0x3D, 0x00, 0x01,
    0xF9, 0x00, 0x3E, 0x00, 0x02, 0x0B, 0x00, 0x3F, 0x00, 0x02, 0x1D, 0x00, 0x40, 0x00, 0x02, 0x2F,
    0x00, 0x41, 0x00, 0x02, 0x41, 0x00, 0x42, 0x00, 0x02, 0x53, 0x00, 0x43, 0x00, 0x02, 0x65, 0x00,
    0x44, 0x00, 0x02, 0x77, 0x00, 0x45, 0x00, 0x02, 0x89, 0x00, 0x46, 0x00, 0x02, 0x9B, 0x00, 0x47,
    };
}